

package com.dog.basics.admin.controller.wishwash.admin;

import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.R;
import com.dog.basics.bean.dto.admin.wishwash.AdminDogHxBankAddDto;
import com.dog.basics.bean.vo.admin.wishwash.AdminDogHxBankInfoVo;
import com.dog.basics.service.wishwash.DogHxBankService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;


/**
 * 银行卡信息
 *
 * @author cy code generator
 * @date 2021-07-09 17:40:27
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/hxbank" )
@Api(value = "银行卡信息", tags = "银行卡信息")
public class DogHxBankController {

    private final  DogHxBankService dogHxBankService;



    /**
     * 通过id查询银行卡信息
     * @param
     * @return R
     * @author cy code generator
     * @date 2021-07-09 17:40:27
     */
    @ApiOperation(value = "获取绑定银行卡信息", notes = "如果绑定银行卡信心为null则是未绑定[admin_doghxbank_info]")
    @GetMapping("/info" )
    @PreAuthorize("@pms.hasPermission('admin_doghxbank_info')" )
    public R<AdminDogHxBankInfoVo> getById() {
        return R.ok(dogHxBankService.getAdminObjXq());
    }

    /**
     * 新增银行卡信息
     * @param obj 银行卡信息
     * @return R
     * @author cy code generator
     * @date 2021-07-09 17:40:27
     */
    @ApiOperation(value = "绑定银行卡[增加|修改]", notes = "admin_doghxbank_add")
    @SysLog("新增银行卡信息[增加|修改]" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('admin_doghxbank_add')" )
    public R<Boolean>  save(@Valid  @RequestBody AdminDogHxBankAddDto obj) {
        return R.ok(dogHxBankService.saveAdminObj(obj));
    }

}
